// pages/group/group.js
import api from '../../utils/api/api'
import tool from "../../utils/publics/tool"
Page({

  /**
   * 页面的初始数据
   */
  data: {
    pinTList: [], // 拼团列表
    isUseShare: true, // 局部分享
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
   
  },
    /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.getData();
  },

  // 获取拼团列表
  getData() {
    api.my_pink().then(res => {
      console.log(res);
      let {
        code,
        data,
        msg
      } = res;
      if (code == 1) {
        this.setData({
          pinTList: data
        })
      }
    })
  },
  // 跳转
  skip(e) {
    let pink_id = e.currentTarget.dataset.pink_id;
    tool.jump_nav(`/pages/pages-list/group-details/group-details?id=${pink_id}`)
  },
  




  /**
   * 用户点击右上角分享
   */
  onShareAppMessage(e) {
    let pink_id = e.target.dataset.pink_id;
    let aid = e.target.dataset.aid;
  if(!pink_id)return    
    let title =  (wx.getStorageSync("userInfo").nickname ? wx.getStorageSync("userInfo").nickname : '') + '邀请您一起拼团参观AG潮人集';
    return {
      title,
      path: `/pages/pages-list/huizhan-details/huizhan-details?id=${aid}&scene=${wx.getStorageSync("scene")||''}&pink_id=${pink_id}`,
      imageUrl: `https://img.vrupup.com/web/rq/ait/images/share.png`,
      query: '分享',

    }
  }
})